package com.booway.demo;

import org.junit.Test;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

/**
 * 
 * @author jsb-hujie
 * 
 * 2020年7月31日
 *
 */
public class DemoJson
{
	@Test
	public void testJson()
	{
		String a = "{\"device\": [\"192.168.1.1\",\"192.168.1.2\"]}";
		JSONObject jsonObject = JSON.parseObject(a);
		
		JSONArray jdArr = jsonObject.getJSONArray("device");
		
		for (int i = 0; i < jdArr.size(); i++)
		{
			String ip = jdArr.getString(i);
			System.out.println(ip);
		}
	}
}
